/* token相关的方法 */
const TOKEN_KEY = 'token';

// 判断用户是否登录
const isLogin = () => {
  return !!localStorage.getItem(TOKEN_KEY);
};

// 获取token
const getToken = () => {
  return localStorage.getItem(TOKEN_KEY);
};

// 设置token
const setToken = (token: string) => {
  localStorage.setItem(TOKEN_KEY, token);
};

// 清除token
const clearToken = () => {
  localStorage.removeItem(TOKEN_KEY);
};

export { isLogin, getToken, setToken, clearToken };
